<template>
  <div class="configDetail">
    <van-nav-bar :title="$route.meta.title" left-arrow :border="false" @click-left="clickLeft" class="nav-bar"> </van-nav-bar>
    <div style="display: flex; justify-content: space-between; align-items: center; margin: 10px 0">
      <van-tag plain type="primary" style="margin: 10px 10px 10px 20px">基本信息</van-tag>
      <div style="display: flex; justify-content: space-between; align-items: center">
        <van-button type="warning" size="small" v-if="state == '已递交'" @click="handleBack" style="margin-right: 25px">撤回</van-button>
        <van-button type="info" size="small" @click="upload()" style="margin-right: 20px">附件上传</van-button>
        <van-button type="info" size="small" @click="otherCite" style="margin-right: 20px">其他引用</van-button>
        <van-button type="info" size="small" @click="getWeightData('1')" style="margin-right: 20px">称重</van-button>
        <van-button type="info" size="small" @click="quoteData()" style="margin-right: 20px">引用</van-button>
        <van-button type="info" size="small" @click="preview()" style="margin-right: 20px">预览</van-button>
        <van-button type="info" size="small" @click="saveItemData()" style="margin-right: 20px">保存</van-button>

        <van-button type="info" size="small" @click="submitItemData()" style="margin-right: 25px">递交</van-button>
      </div>
    </div>
    <van-row type="flex">
      <van-col span="12" class="readonly">
        <van-field v-model="treeNode.code" label="No" input-align="center" readonly> </van-field>
      </van-col>
      <van-col span="12" class="readonly">
        <van-field v-model="treeNode.materialName" label="检品名称" input-align="center" readonly> </van-field>
      </van-col>
      <van-col span="12">
        <van-field readonly clickable label="批号" v-model="batchID" placeholder="请选择" @click="showBatchListPicker = true" class="select-record" input-align="center" />
      </van-col>
      <van-col span="12" class="readonly">
        <van-field v-model="treeNode.standardBaseOn" label="标准" input-align="center" readonly> </van-field>
      </van-col>
      <van-col span="12">
        <van-field readonly clickable label="检验记录" v-model="recordName" placeholder="请选择" @click="handleShowRecodePopup" class="select-record" input-align="center" />
      </van-col>
      <van-col span="12" class="readonly">
        <van-field v-model="state" label="状态" input-align="center" readonly> </van-field>
      </van-col>
      <van-col span="12" class="readonly" v-if="state == '驳回'">
        <van-field v-model="reason" label="驳回理由" input-align="center" readonly> </van-field>
      </van-col>
    </van-row>
    <van-row class="cd-content" type="flex" align="center" justify="space-between">
      <van-col span="12" v-show="recordShow" class="van-col">
        <div class="title">
          <span>检验记录</span>
          <van-icon class="recordIcon" name="expand-o" @click="showModel('recordIcon')" />
        </div>
        <!-- <div id="recordPdf"></div> -->
				 <div class="HPDFViewer">
					 <HPDFViewer :path="recordPdfUrl" :searchKeyword="searchKeyword"></HPDFViewer>
				 </div>
      </van-col>
      <van-col span="12" v-show="itemShow" class="van-col">
        <div class="title">
					<div style="display: flex;align-items: center;">
						<span>检验项目</span>
						<van-button type="default" size="small" @click="editData" style="padding:5px;margin: 0 5px;">一键返填</van-button>
						<van-button type="default" size="small" @click="computedData" style="padding:5px;margin: 0 5px;">一键计算</van-button>
					</div>

          <!-- <div @click="openScan('3')">
           
            <van-icon name="scan" size="20" />
          </div> -->
          <van-icon class="itemIcon" name="expand-o" @click="showModel('itemIcon')" />
        </div>
        <div id="conList" v-html="itemHtm"></div>
      </van-col>
    </van-row>

    <van-popup ref="pickerRef" v-model="showPicker" :style="{ height: '50%' }" position="bottom" get-container="body" :lock-scroll="false">
      <van-cascader :style="{ height: '100%' }" v-model="cascaderValue" :options="options" @close="showPicker = false" @finish="onFinish" :field-names="fieldNames" />
    </van-popup>
    <van-popup v-model="showBatchListPicker" :style="{ height: '50%' }" position="bottom" get-container="body" :lock-scroll="false">
      <van-picker title="选择批号" show-toolbar value-key="batchID" :default-index="batchList.findIndex((item) => item.batchID === batchID)" :columns="batchList" @confirm="onBatchListConfirm" />
    </van-popup>
    <!-- <van-popup
      v-model="showSamplePicker"
      :style="{ height: '50%' }"
      position="bottom"
      get-container="body"
      :lock-scroll="false"
    >
      <van-cascader
        :style="{ height: '100%' }"
        v-model="sampleValue"
        :options="sampleArr"
        @close="showSamplePicker = false"
        @finish="onSampleFinish"
        :field-names="sampleNames"
      />
    </van-popup> -->

    <van-popup v-model="PDFShow" position="left" :style="{ width: '60%', height: '100%' }">
      <van-row type="flex" align="center" justify="space-between" class="van-row-style">
        <van-col span="14" class="van-col-style" style="display: flex; align-items: center; justify-content: space-between">
          <div style="display: flex; align-items: center">
            <span style="white-space: nowrap">PDF上传：</span>
          </div>
          <van-dropdown-menu>
            <van-dropdown-item v-model="attachmentId" :options="pdfArr" />
          </van-dropdown-menu>
          <van-button type="primary" size="small" @click="delPdfList()">删除</van-button>
        </van-col>

        <van-col span="10" class="van-col-style" style="display: flex; align-items: center; justify-content: space-between">
          <van-uploader :max-count="1" :after-read="afterRead" accept=".pdf,.PDF">
            <van-button icon="plus" type="primary" size="small">上传</van-button>
          </van-uploader>
          <van-button class="van-col-btn" type="primary" size="small" @click="getPdfData()" style="margin-left: 10px">一键赋值</van-button>
          <van-button class="van-col-btn" type="primary" size="small" @click="assignPdfData()">确定</van-button>
        </van-col>
      </van-row>
      <van-row class="cd-content" type="flex" align="center" justify="space-between">
        <van-col span="12" class="van-col">
          <div class="title">
            <span>检验记录</span>
          </div>
          <div id="uploadPdf1"></div>
        </van-col>
        <van-col span="12" class="van-col">
          <div class="title">
            <span>检验项目</span>
            <span class="itemIcon"><input type="checkbox" style="width: 20px; height: 20px" />全选</span>
          </div>
          <div id="PDFList" v-html="pdfHtm"></div>
        </van-col>
      </van-row>
    </van-popup>

    <van-popup v-model="PDFShow1" position="left" :style="{ width: '60%', height: '100%' }">
      <van-row class="cd-content" type="flex" align="center" justify="space-between">
        <van-col span="24" class="van-col">
          <div id="uploadPdf1"></div>
        </van-col>
      </van-row>
    </van-popup>

    <div class="scan" v-if="scanShow">
      <div id="bcid">
        <div style="height: 40%"></div>
        <p class="tip">...载入中...</p>
      </div>
      <footer>
        <button @click="closeModel">退出</button>
      </footer>
    </div>

    <van-popup v-model="showItem" position="bottom" :style="{ height: '50%' }" @close="closePopup" get-container="body">
      <div class="van-picker__toolbar">
        <button type="button" class="van-picker__cancel" @click="cancel">取消</button>
        <button type="button" class="van-picker__confirm" @click="onConfirm">确认</button>
      </div>
      <div class="checkbox-con" style="overflow-y: auto">
        <van-cell title="全选">
          <template #right-icon>
            <van-checkbox name="all" @click="toggleAll" shape="square" v-model="checkedAll" />
          </template>
        </van-cell>
        <van-checkbox-group v-model="checkBoxArr" ref="checkboxGroup">
          <van-cell-group>
            <van-cell v-for="(item, index) in columns" clickable v-model="columns[index]" :key="columns[index]">
              <template #right-icon>
                <van-checkbox :name="columns[index]" shape="square" ref="checkboxes" />
              </template>
            </van-cell>
          </van-cell-group>
        </van-checkbox-group>
      </div>
    </van-popup>

    <van-popup v-model="showSingle" get-container="body" position="bottom" :style="{ height: '50%' }">
      <van-picker show-toolbar :columns="singleColumns" @cancel="showSingle = false" @confirm="onConfirmSingle" />
    </van-popup>

    <van-popup v-model="showQuote" safe-area-inset-bottom get-container="body" position="left" style="width: 80vw; height: 100% !important">
      <div class="popup-content__title">
        <div class="title">记录引用</div>
      </div>
      <div class="popup-content">
        <div class="popup-content__content">
          <van-row>
            <van-col span="12">
              <van-field v-model="quote_materialType" name="quote_materialType" label="检品类型" required input-align="center" :rules="[{ required: true, message: '请选择检品类型' }]">
                <template #input>
                  <material-type v-model="quote_materialType" />
                </template>
              </van-field>
            </van-col>
            <van-col span="12">
              <van-field v-model="quote_materialCode" name="quote_materialCode" label="检品名称" required input-align="center" :rules="[{ required: true, message: '请选择检品名称' }]">
                <template #input>
                  <material-name :materialType="quote_materialType" v-model="quote_materialCode" />
                </template>
              </van-field>
            </van-col>
            <van-col span="12">
              <van-field v-model="quote_batchID" name="quote_batchID" label="批号" required clickable input-align="center" :rules="[{ required: true, message: '请输入批号' }]">
                <template #input>
                  <batch-list-quote v-model="quote_batchID" :materialCode="quote_materialCode"> </batch-list-quote>
                </template>
              </van-field>
            </van-col>
            <van-col span="12">
              <van-field v-model="quote_testID" name="quote_testID" label="检验编号" required readonly input-align="center" @click="showTest = true" :rules="[{ required: true, message: '请选择检验编号' }]"> </van-field>
            </van-col>
          </van-row>
          <div style="display: flex; justify-content: flex-end; padding: 10px 25px; gap: 0.1rem">
            <van-button plain name="search" size="small" type="info" @click="handleSearch()">查询</van-button>
            <van-button plain name="check" size="small" type="primary" @click="handleSave()">保存</van-button>
          </div>
        </div>
      </div>
      <div class="popup-content__footer">
        <!-- <textarea name="" cols="30" rows="8"></textarea> -->
        <ul class="searchDetail" v-html="liHtml"></ul>
      </div>
    </van-popup>

    <van-popup v-model="showCite" safe-area-inset-bottom get-container="body" position="left" style="height: 100% !important">
      <div class="popup-box">
				<div class="popup-content__title">
        <div class="title">其他记录引用</div>
      </div>

			<div class="citeRecord-box">
				<div class="citeRecord-box-item" v-for="item in citeCheckProjectList" :key="item.attributeCode">
					<div class="item-title">
						<span>{{ item.attributeName }}</span>
					</div>
					<div class="item-value">
						<span @click="copyToClipboard(item.attributeValue)">{{ item.attributeValue }}</span>
					</div>
					<van-button type="primary" size="small" @click="copyToClipboard(item.attributeValue)">复制</van-button>
				</div>
			</div>
			</div>

    </van-popup>
    <van-popup v-model="showCitepCheckProject" round position="bottom" :style="{ height: '50%' }">
      <!-- <van-cascader :style="{ height: '100%' }" v-model="cascaderValue" :options="options" @close="showPicker = false" @finish="onFinish" :field-names="fieldNames" /> -->
      <van-cascader :style="{ height: '100%' }" v-model="citeCheckProject" :options="options" @close="showCitepCheckProject = false" @finish="onConfirmCiteCheckProject" :field-names="fieldNames" />
    </van-popup>
    <van-popup v-model="showTest" round position="bottom" :style="{ height: '50%' }">
      <van-picker show-toolbar :columns="testList" @cancel="showTest = false" @confirm="onConfirmTest" />
    </van-popup>
    <van-popup v-model="showDate" round position="bottom" :style="{ height: '50%' }">
      <van-datetime-picker v-model="currentDate" :type="datePickerType" title="选择月日" :min-date="minDate" :max-date="maxDate" :formatter="formatter" @confirm="onConfirmDate" />
    </van-popup>
    <van-popup v-model="showPdf" position="left" :style="{ width: '50%', height: '100%' }">
      <HPDFViewer :path="pdfUrl"></HPDFViewer>
    </van-popup>
  </div>
</template>

<script type="text/ecmascript-6">
    import HPDFViewer from "@/components/HPDFViewer";
    import {
      deleteEquipFile,
      GetBatchReportData,
      GetCalculateResult,
      GetClassUserSelect,
      GetClassUserSelectThree,
      getConfigAttributesText,
      getEquipmentFileSelect,
      GetLogicResultAndOr,
      GetRecordReportActiveTree,
      GetRecordReportAttributes,
      GetRecordReportData,
      GetRecordReportDataTwo,
      getReportId,
      getTestByTestId,
      getTestTree,
      GetUserInfo,
      PreviewElectronicRecordModel,
      PreviewElectronicRecordReport,
      ReturnDJData,
      SaveRecordReportData,
      SubmitRecordApprove,
      uploadEquipmentFile,
    } from "@/api/base";
    import { GetAttributeValue,RevocationRecordApprove,GetCiteOtherAttributeValue } from "@/api/check";
    import MaterialName from "@/components/MaterialName";
    import MaterialType from "@/components/MaterialType";
    import {
      Button,
      DatetimePicker,
      Dialog,
      Calendar,
      cascader,
      Cell,
      CellGroup,
      Checkbox,
      CheckboxGroup,
      Col,
      DropdownItem,
      DropdownMenu,
      Field,
      Icon,
      NavBar,
      Notify,
      Picker,
      Popup,
      Row,
      Tabbar,
      TabbarItem,
      Tag,
      Uploader,
			Loading,
    } from "vant";
    import BatchListQuote from "./BatchListQuote.vue";
    import dayjs from "dayjs";
    import { to } from "@/utils";
    import $ from "jquery";
    import Pdfh5 from "pdfh5";
    import "pdfh5/css/pdfh5.css";
    const axios = require("axios");
    let scan = null;
    export default {
      name: "configDetail",
      components: {
        HPDFViewer,
        [DatetimePicker.name]: DatetimePicker,
        [Tabbar.name]: Tabbar,
        [TabbarItem.name]: TabbarItem,
        [NavBar.name]: NavBar,
        [Icon.name]: Icon,
        [Cell.name]: Cell,
        [CellGroup.name]: CellGroup,
        [Col.name]: Col,
        [Row.name]: Row,
        [Button.name]: Button,
        [Popup.name]: Popup,
        [Field.name]: Field,
        [Calendar.name]: Calendar,
        [Notify.name]: Notify,
        [Uploader.name]: Uploader,
        [DropdownMenu.name]: DropdownMenu,
        [DropdownItem.name]: DropdownItem,
        [Checkbox.name]: Checkbox,
        [CheckboxGroup.name]: CheckboxGroup,
        [Picker.name]: Picker,
        [cascader.name]: cascader,
        [Tag.name]: Tag,
        MaterialType,
        MaterialName,
        BatchListQuote,
      },
      data() {
        return {
  				pickerRef: null,
    			searchKeyword: '', //搜索关键字
          showPdf: false,
    			recordPdfUrl: "",
          pdfUrl: "",
          showDate: false,
          currentDate: "",
          token: "",
          gDomain: "",
          value: "",
          showPicker: false,
          recordName: "",
          options: [],
          params: "",
          mCode: "",
  				showCite: false, //其他记录引用
  				showCitepCheckProject: false, //其他记录引用
  				citeCheckProject: "", //其他记录引用
  				citeCheckProjectName: "", //其他记录引用
  				citeCheckProjectList: [], //其他记录引用
          minDate: new Date(new Date().getFullYear(), 0, 1),
          maxDate: new Date(new Date().getFullYear(), 11, 31),
          datePickerType: "date",
          dateFormatType: "",
          dataNum: "",
          clickCode: "",
          materialCode: "",
          materialName: "",
          batchID: "",
          standardBaseOn: "",
          testStandard: "",
          recordCode: "",
          pdfUrl: "",
          cascaderValue: "",
          fieldNames: {
            text: "name",
            value: "code",
          },
          pdfh5: null,
          type: {
            Varchar: false,
          },
          itemHtm: "",
          itemDataArr: [],
          codeUrl: "",
          scanShow: false,
          scanCode: "",
          dataVal: "",
          recordShow: true,
          itemShow: true,
          sampleName: "", //合并后检验样品
          showSamplePicker: false,
          sampleArr: [],
          sampleValue: "",
          sampleNames: {
            text: "name",
            value: "code",
          },
          totalData: {},
          timer: null,
          timer1: null,
          scanType: "",
          scanObj: {},
          PDFShow: false,
          PDFShow1: false,
          pdfName: "",
          pdfArr: [],
          attachmentId: "",
          pdfHtm: "",
          reason: "",
          //复选弹窗
          showItem: false,
          checkBoxArr: [],
          columns: [],
          checkedAll: false,
          checkBoxName: "",
          //
          dataCode: "",
          //单选弹窗
          showSingle: false,
          singleColumns: [],
          showEquipType: "",
          treeNode: "", //待我检验点击树信息
          state: "", //检验状态
          quote_materialType: "",
          quote_materialCode: "",
          quote_batchID: "",
          quote_testID: "",
          showTest: false,
          testList: [],
          showQuote: false,
          showBtn: false,
          liHtml: "",
          quoteDataArr: [],
    			showBatchListPicker: false, //批号
          batchList: [], //批号
          batchListValue: "", //批号
          batchListNames: { //批号
            text: "name",
            value: "code",
          },
        };
      },
      watch: {
        attachmentId(val) {
          // this.showUploadPdf();
        },
        quote_batchID(val) {
          if (val) {
            this.getTestId();
          }
        },
      },
      mounted() {
        this.gDomain = localStorage.getItem("domainKey");
        this.token = localStorage.getItem("tokenKey");
        // this.getSampleData();
        // this.fetchItems();
      },
      methods: {
  			async copyToClipboard(text) {
					try {
						const clipboard = navigator.clipboard || {
							writeText: (text) => new Promise((resolve, reject) => {
								const textarea = document.createElement('textarea');
								textarea.value = text;
								document.body.appendChild(textarea);
								textarea.select();
								document.execCommand('copy') ? resolve() : reject();
								document.body.removeChild(textarea);
							})
						};
						await clipboard.writeText(text);
						this.$notify({ type: 'success', message: `${text}复制成功` });
					} catch {
						this.$notify({ type: 'danger', message: `${text}复制失败` });
					}
				},
  			handleShowRecodePopup() {
          this.showPicker = true;
  				this.$nextTick(() => {
  				this.$refs.pickerRef.$el.scrollTop = 0;
  			});
  			},
    		// 切换批号
    		onBatchListConfirm(val) {
    			this.treeNode = val;
    			this.mCode = this.treeNode.code;
					this.sampleName = this.treeNode.name;
					this.mCode = this.treeNode.code;
					this.materialName = this.treeNode.materialName;
					this.batchID = this.treeNode.batchID;
					this.standardBaseOn = this.treeNode.standardBaseOn;
					this.materialCode = this.treeNode.materialCode;
					this.testStandard = this.treeNode.testStandard;
					this.recordName = "";
					this.recordCode = "";
					this.recordPdfUrl = "";
					this.itemHtm = "";
					this.state = "";
					this.cascaderValue = "";

					this.fetchItems();
					this.showBatchListPicker = false;
    			// this.batchID = val;
    			// this.getRecordReportData();
    		},
    		//点击撤回记录
    		handleBack () {
    			if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
    			Dialog.confirm({
            message: "确定撤回吗？",
          })
            .then(() => {
    					var result = {
    						Token: this.token,
    						testID: this.treeNode.code,
    						recordCode: this.recordCode,
    					};
    					RevocationRecordApprove(result)
            .then((res) => {
              if (res.ErrorCode=='0') {
                Notify({ type: "success", message: "撤回成功" });
    						this.itemHtm = "";
                // $("#recordPdf").html("");
    						this.recordPdfUrl = "";
    						this.recordName = "";
    						this.recordCode = "";
    						this.state = "";
    						this.fetchItems();
    						// this.cascaderValue = "";
    						// this.getRecordReportData()
              }

            })
            .catch(() => {});

    				})
    			},
        preview() {
          if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          var params = {
            Token: this.token,
            testID: this.mCode,
            recordCode: this.recordCode,
          };
          PreviewElectronicRecordReport(params)
            .then((res) => {
              if (res) {
                var targetPath = res.Result.path;
                if (targetPath) {
                  this.pdfUrl = targetPath;
                  this.showPdf = true;
                } else {
                  this.pdfUrl = "";
                  Notify({
                    type: "danger",
                    message: "暂无PDF文件",
                  });
                }
              }
            })
            .catch(() => {});
        },
        formatter(type, val) {
          if (type === "month") {
            return `${val}月`;
          } else if (type === "day") {
            return `${val}日`;
          }
          return val;
        },
        upload() {
          if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          this.$store.commit("SET_PAGE_PARAMS", {
            testStandard: this.testStandard,
            batchId: this.batchID,
            materialCode: this.materialCode,
            recordCode: this.recordCode,
            testId: this.treeNode.code,
          });
          this.$router.push({ name: "fileGrabOrUpload" });
        },
        clickLeft() {
          if (scan && scan != "") {
            scan.close();
          }
          this.$router.replace({ name: "myCheckObject",params: {
    				treeNode: JSON.stringify(this.treeNode)
    			 }
    			});
        },
        async getSampleData() {
          var that = this;
          var queryParams = {
            pageModel: { Search: [30, "UrgencyDegree"], Token: this.token },
          };
          const [err, res] = await to(getTestTree(queryParams));
          if (err) return;
          var result = res.Result;
          this.dowhile(result);
          this.sampleArr = result;
        },
        // onSampleFinish({ selectedOptions }) {
        //   this.showSamplePicker = false;
        //   var len = selectedOptions.length;
        //   var toDetail = selectedOptions[len - 1];
        //   this.sampleName = toDetail.name;
        //   this.mCode = toDetail.code;
        //   this.materialName = toDetail.materialName;
        //   this.batchID = toDetail.batchID;
        //   this.standardBaseOn = toDetail.standardBaseOn;
        //   this.materialCode = toDetail.materialCode;
        //   this.testStandard = toDetail.testStandard;
        // },
        onFinish({ selectedOptions }) {
          this.showPicker = false;
          var len = selectedOptions.length;
          var toDetail = selectedOptions[len - 1];
          this.recordName = toDetail.name;
          this.recordCode = toDetail.code;
          this.handlePdf();
          this.handleItem();
        },
        dowhile(b) {
          for (var i = 0; i < b.length; i++) {
            if (b[i].children && b[i].children.length > 0) {
              this.dowhile(b[i].children);
            } else {
              delete b[i].children;
            }
          }
        },
        fetchItems() {
          var that = this;
          var queryParams = {
            materialCode: this.treeNode.materialCode,
            StandardCode: this.treeNode.testStandard,
            Token: this.token,
            TestId: this.mCode,
          };
          // const [err, res] = await to(GetRecordReportActiveTree(queryParams));
          // if (err) return;
          GetRecordReportActiveTree(queryParams).then((res) => {
            if (res.ErrorCode == 0) {
              var result = res.Result;
              if (!result || result.length == 0) return false;
              that.dowhile(result);
              that.options = result;
            }
          });
        },
        onConfirmDate(value) {
          var newTime;
          let dateFormat = this.dateFormatType.replace(/d/g, "D");
          dateFormat = dateFormat.replace(/y/g, "Y");
          newTime = dayjs(value).format(dateFormat);

          // 获取当前点击的input元素的dataNum属性
          const currentInput = this.dataNum
            ? $(`input[dataCode="${this.clickCode}"][dataNum="${this.dataNum}"]`)
            : $(`input[dataCode="${this.clickCode}"]`);
          const dataNum = currentInput.attr("dataNum");
          // todo 时间校验还有问题
          if (dataNum) {
            const inputs = $(`input[dataCode="${this.clickCode}"]`);
            const firstInput = inputs.eq(0);
            const secondInput = inputs.eq(1);

            if (dataNum === "1") {
              // 如果第二个输入框有值，需要比较
              if (secondInput.val()) {
                const secondTime = dayjs(secondInput.val(), dateFormat);
                if (dayjs(value).isAfter(secondTime)) {
                  Notify({ type: "warning", message: "开始时间不能大于结束时间" });
                  return;
                }
              }
              firstInput.val(newTime);
            } else if (dataNum === "2") {
              // 如果第一个输入框有值，需要比较
              if (firstInput.val()) {
                const firstTime = dayjs(firstInput.val(), dateFormat);
                if (dayjs(value).isBefore(firstTime)) {
                  Notify({ type: "warning", message: "结束时间不能小于开始时间" });
                  return;
                }
              }
              secondInput.val(newTime);
            }
          } else {
            // 单个日期输入框的情况
            $(`input[dataCode="${this.clickCode}"]`).val(newTime);
          }

          this.showDate = false;
        },
        handlePdf() {
          var that = this;
          this.pdfh5 = null;
          var queryParams = {
            recordCode: this.recordCode,
            Token: this.token,
          };
          // const [err, res] = await to(PreviewElectronicRecordModel(queryParams));
          // if (err) return;
          PreviewElectronicRecordModel(queryParams).then((res) => {
            if (res.ErrorCode == 0) {
              var targetPath = res.Result.targetPath;
    					this.recordPdfUrl = targetPath;
            }
          });
        },
        handleItem() {
          var that = this;
          var queryParams = {
            recordCode: that.recordCode,
            testID: this.treeNode.code,
            testStandard: this.treeNode.testStandard,
            Token: this.token,
          };
          // const [err, res] = await to(GetRecordReportAttributes(queryParams));
          // if (err) return;
          GetRecordReportAttributes(queryParams).then((res) => {
            if (res.ErrorCode == 0) {
              var htm = "";
              var result = res.Result;
              if (result && result.length > 0) {
                that.itemDataArr = result;
                result.map((item, index) => {
                  if (item.type == "Varchar") {
                    if (item.wordCode == "${B1}") {
                      htm +=
                        "<div class='listDetail'><div>" +
                        item.wordCode +
                        ":" +
                        item.name +
                        "</div>";
                      htm +=
                        "<div class='listValue'>值：<input dataCode=" +
                        item.code +
                        "  name='Varchar'  class='" +
                        item.code +
                        "' type='text' dataName='" +
                        item.name +
                        "' ><span>" +
                        item.unit +
                        "</span><button class='Varchar' style='width:40%'>一键赋值</button></div>";
                      htm += "</div>";
                    } else {
                      htm +=
                        "<div class='listDetail'><div>" +
                        item.wordCode +
                        ":" +
                        item.name +
                        "</div>";
                      htm +=
                        "<div class='listValue'>值：<input dataCode=" +
                        item.code +
                        " name='Varchar' class='" +
                        item.code +
                        "' type='text' dataName='" +
                        item.name +
                        "'><span>" +
                        item.unit +
                        "</span><button class='Varchar2' dataVal=" +
                        JSON.stringify(item.data) +
                        " style='width:20%'>选择</button></div>";
                      htm += "</div>";
                    }
                  } else if (item.type == "DataInterchange") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue'>值：<input dataCode=" +
                      item.code +
                      "  name='DataInterchange'  class='" +
                      item.code +
                      "' type='text' dataName='" +
                      item.name +
                      "'><span>" +
                      item.unit +
                      "</span><button class='DataInterchange' style='width:40%'>一键赋值</button></div>";
                    htm += "</div>";
                  } else if (item.type == "Radio") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue'>值：<input name='Radio' dataVal=" +
                      JSON.stringify(item.data) +
                      " dataCode=" +
                      item.code +
                      "  class='radioSelect " +
                      item.code +
                      "' dataId='' type='text' readonly dataName='" +
                      item.name +
                      "'></div>";

                    htm += "</div>";
                  } else if (item.type == "Float") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue formulaOne formulaTwo'>值：<input dataCode=" +
                      item.code +
                      " name='Float' class=" +
                      item.code +
                      " type='text' dataName='" +
                      item.name +
    									"' dataUpLine='" +
    									item.upLine +
    									"' dataLowLine='" +
    									item.lowLine +
                      "'><span>" +
                      item.unit +
                      "</span></div>";
                    htm += "</div>";
                  } else if (item.type == "Weight") {
                    htm += `
                      <div class='listDetail'>
  											<div> ${item.wordCode} :${item.name}</div>
                        <div class='listValue formulaOne formulaTwo'>值：
  												<input dataCode='${item.code}' name='Weight' class='${item.code}' type='text' readonly dataName='${item.name}'>
  												${item.unit?`<span>${item.unit}</span>`:''}
  												
  											</div>
  										</div>`;
											// <button class='weightBtn' dataCode='${item.code}' style='width:40%'>称重</button>
                  } else if (item.type == "Choose") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue'>值：<input  name='Choose' dataVal=" +
                      JSON.stringify(item.data) +
                      " dataCode=" +
                      item.code +
                      " class='multSelect' type='text' dataName='" +
                      item.name +
                      "'><span>" +
                      item.unit +
                      "</span></div>";
                    htm += "</div>";
                  } else if (item.type == "Date") {
                    let dataList = item.data[0].split("-");
                    if (
                      item.data[0].indexOf("-") > -1 &&
                      item.data[0] != "yyyy-MM-dd" &&
                      item.data[0] != "yyyy-MM-dd HH:mm:ss"
                    ) {
                      htm += `
    									<div class='listDetail'>
    										<div>${item.wordCode}:${item.name}</div>
    										<div class='listValue'>值：
    											<input
    												dataCode="${item.code}"
    												name="Date"
    												class="${item.code}"
    												type="text"
    												readonly
    												dataNum="1"
    												${item.isUpdateDate ? "" : "disabled"}
    												style="${item.isUpdateDate ? "" : "background:#cccaca"}"
    												data-isUpdateDate="${item.isUpdateDate}"
    												dataName="${item.name}"
    												data-val="${dataList[0]}"
    											>

    											<input
    												dataCode="${item.code}"
    												name="Date"
    												class="${item.code}"
    												type="text"
    												readonly
    												style="${item.isUpdateDate ? "" : "background:#cccaca"}"
    												${item.isUpdateDate ? "" : "disabled"}
    												data-isUpdateDate="${item.isUpdateDate}"
    												dataNum="2"
    												dataName="${item.name}"
    												data-val="${dataList[1]}"
    											>
    											${item.unit?`<span>${item.unit}</span>`:''}
    											<button class='Date dateClearBtn' dataName="${item.name}"  data-val="${ item.data[0]}" style='width:40%'>清空</button>
    										</div>
    									</div>
    								`;
                    } else {
                      htm += `
    										<div class='listDetail'>
    											<div>${item.wordCode}:${item.name}</div>
    											<div class='listValue'>值：
    												<input
    													dataCode="${item.code}"
    													name="Date"
    													class="${item.code}"
    													type="text"
    													readonly
    													${item.isUpdateDate ? "" : "disabled"}
    													style="${item.isUpdateDate ? "" : "background:#cccaca"}"
    													data-isUpdateDate="${item.isUpdateDate}"
    													dataName="${item.name}"
    													data-val="${item.data[0]}"
    												>
    												${item.unit?`<span>${item.unit}</span>`:''}
    												<button class='Date dateSetBtn' dataName="${item.name}"  data-val="${ item.data[0]}" style='width:40%'>一键赋值</button>
    												<button class='Date dateSetBtnXG' dataName="${item.name}"  data-val="${ item.data[0]}" style='width:40%'>赋值为 / </button>
    											</div>
    										</div>
    									`;
                    }
                  } else if (item.type == "Scan") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue'>值：<input dataCode=" +
                      item.code +
                      " name='Scan' class=" +
                      item.code +
                      " type='text' dataName='" +
                      item.name +
                      "'><button class='Scan' data-val='" +
                      JSON.stringify(item.data) +
                      "' >扫码</button></div>";
                    htm += "</div>";
                  } else if (item.type == "Calculate") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue formulaOne formulaTwo'>值：<input dataCode=" +
                      item.code +
                      " name='Calculate' class=" +
                      item.code +
                      " type='text' dataName='" +
                      item.name +
                      "'><span>" +
                      item.unit +
                      "</span><button class='Calculate'>计算</button></div>";
                    htm += "</div>";
                  } else if (item.type == "BoolResult"|| item.type == 'BoolResultAnd' || item.type == 'BoolResultOr') {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue formulaTwo'>值：<input dataCode=" +
                      item.code +
                      " name='BoolResult' class=" +
                      item.code +
                      " type='text' dataName='" +
                      item.name +
                      "'><span>" +
                      item.unit +
                      "</span><button class='BoolResult'>计算</button></div>";
                    htm += "</div>";
                  } else if (item.type == "Select") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    if (item.data[0] == "user") {
                      htm +=
                        "<div class='listValue'>值：<input type='user' dataCode=" +
                        item.code +
                        " name='Select' class=" +
                        item.code +
                        " type='text' dataId='' dataName='" +
                        item.name +
                        "'><button class='Select' >检测员</button></div>";
                    } else if (item.data[0] == "team") {
                      htm +=
                        "<div class='listValue'>值：<input name='Select' dataCode=" +
                        item.code +
                        "  class='singleSelect " +
                        item.code +
                        "' dataId='' type='text' dataVal='team' readonly dataName='" +
                        item.name +
                        "'></div>";
                    } else {
                      htm +=
                        "<div class='listValue'>值：<input name='Select' dataCode=" +
                        item.code +
                        "  class='singleSelect " +
                        item.code +
                        "' dataId='' type='text' readonly dataName='" +
                        item.name +
                        "'></div>";
                    }

                    htm += "</div>";
                  } else if (item.type == "PDF") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue mainPdf formulaOne formulaTwo'>值：<input dataCode=" +
                      item.code +
                      " name='PDF' class=" +
                      item.code +
                      " type='text' dataName='" +
                      item.name +
                      "'></div>";
                    htm += "</div>";
                  } else if (item.type == "AutoCoding") {
                    htm +=
                      "<div class='listDetail'><div>" +
                      item.wordCode +
                      ":" +
                      item.name +
                      "</div>";
                    htm +=
                      "<div class='listValue formulaOne formulaTwo'>值：<input dataCode=" +
                      item.code +
                      " name='AutoCoding' class=" +
                      item.code +
                      " type='text' readonly dataName='" +
                      item.name +
                      "'><span>" +
                      item.unit +
                      "</span></div>";
                    htm += "</div>";
                  }
                });
              }
              that.itemHtm = htm;
              that.getRecordReportData();
            }
          });

    			$('#conList').on('click', '.weightBtn', function () {
    				// 找到当前点击元素下的第一个div
  					const code = $(this).attr('dataCode');
    				that.getWeightData(3, code);
    			})

    			$('#conList').on('click', '.listDetail', function () {
    				// 找到当前点击元素下的第一个div
    				const $div = $(this).find('div')[0];
    				const wordCode = $div.innerText.split(':')[0];
    				that.searchKeyword = wordCode;
    				console.log('that.searchKeyword',that.searchKeyword)
    			})

    			// 公式 计算按钮点击
    			$("#conList").on("blur", ".listValue input", function () {
    				var type = $(this).attr("name");
    				var valThis = $(this).val();

    				switch (type) {
    					case 'Float':
    						if(isNaN(Number(valThis))){
    							$(this).val("")
    							Notify({ type: "danger", message: "请输入数字" });
    							return;
    						}
    						valThis = Number(valThis);
    						const  upLine = Number($(this).attr("dataUpLine"));
    						const  lowLine = Number($(this).attr("dataLowLine"));

    						// 判断值是否在区间内
    						if(upLine && lowLine){
    							if(valThis < lowLine || valThis > upLine){
    								Notify({ type: "danger", message: `请输入下限${lowLine}-上限${upLine}区间的值` });
    								$(this).val("");
    							}
    						}
    						// 只配置了上限
    						if(upLine && !lowLine){
    							if(valThis > upLine){
    								Notify({ type: "danger", message: "值不可大于上限"+upLine });
    								$(this).val("");
    							}
    						}
    						// 只配置了下限
    						if(!upLine && lowLine){
    							if(valThis < lowLine){
    								Notify({ type: "danger", message: "值不可小于下限"+lowLine });
    								$(this).val("")
    							}
    						}
    						break;
    					default:
    						break;
    				};
    			});

          $("#conList").on("click", ".multSelect", function () {
            that.checkBoxArr = [];
            var dataVal = JSON.parse(this.attributes[1].value);
            that.dataCode = this.attributes[2].value;
            that.columns = dataVal;
            that.showItem = true;
          });

          $("#conList").on("click", ".singleSelect", function () {
            that.dataCode = this.attributes[1].value;
            var dataVal = this.getAttribute("dataval");
            if (dataVal && dataVal == "team") {
              var result = { pageModel: { Token: that.token } };
              GetClassUserSelectThree(result).then(function (response) {
                var res = response.Result;
                if (response.ErrorCode == 0) {
                  if (res && res.length > 0) {
                    that.singleColumns = res;
                    that.showSingle = true;
                  }
                }
              });
            } else {
              var result = {
                pageModel: { Token: that.token },
              };
              GetClassUserSelect(result).then(function (response) {
                var res = response.Result;
                if (response.ErrorCode == 0) {
                  if (res && res.length > 0) {
                    that.singleColumns = res;
                    that.showSingle = true;
                  }
                }
              });
            }
          });

          $("#conList").on("click", ".radioSelect", function () {
            var dataVal = JSON.parse(this.attributes[1].value);
            that.dataCode = this.attributes[2].value;
            if (dataVal && dataVal.length) {
              var radioDataArr = [];
              dataVal.map((item) => {
                radioDataArr.push({
                  value: item,
                  text: item,
                });
              });
              that.singleColumns = radioDataArr;
              that.showSingle = true;
            }
          });

          $("#conList").on("click", "button.Varchar2", function () {
            var dataVal = JSON.parse(this.attributes[1].value);
            that.dataCode = $(this).siblings("input")[0].classList.value;
            if (dataVal && dataVal.length > 0) {
              that.singleColumns = dataVal;
              that.showSingle = true;
            }
          });

          $("[name=Varchar]").on("input", function () {
            var valThis = $(this).val();
            if (valThis == "\\") {
              $(this).val("");
              Notify({ type: "danger", message: "请勿输入\\" });
            }
          });

          $("#conList").on("click", "button.Varchar", function () {
            var thisVal = $(this).siblings("input").val();
            var thisCode = $(this).siblings("input")[0].classList.value;
            var q = {
              batchID: thisVal,
              recordCode: that.recordCode,
              Token: that.token,
            };

            GetBatchReportData(q).then(function (response) {
              var res = response.Result;
              if (response.ErrorCode == 0) {
                if (res.data.length == 0) {
                  Notify({ type: "danger", message: "当前批号无数据" });
                  return false;
                } else {
                  res.data.map((item) => {
                    if (thisCode != item.attributeCode)
                      $("." + item.attributeCode).val(item.attributeValue);
                  });
                }
              }
            });
          });

          $("#conList").on("click", "button.DataInterchange", function () {
            // var thisVal = $(this).siblings("input").val();
            // var thisCode = $(this).siblings("input")[0].classList.value;

            var q = {
              TestID: that.mCode,
              RecordCode: that.recordCode,
              Token: that.token,
            };
            ReturnDJData(q).then(function (response) {
              var res = response.Result;
              if (response.ErrorCode == 0) {
                res.map((item) => {
                  $("." + item.AttributeCode).val(item.AttributeValue);
                });
              }
            });
          });

          $("#conList").on("click", "button.Select", function () {
            var _that = this;
            var a = { value: "user", url: "API/BaseData/GetUserInfo", ajax: "get" };
            var result = {
              Token: that.token,
            };
            GetUserInfo(result).then(function (res) {
              if (res.ErrorCode == 0) {
                var userName = res.Result.userName;
                var userID = res.Result.userID;
                $(_that).siblings("input").attr("dataId", userID);
                $(_that).siblings("input").val(userName);
              }
            });
          });

					// 一键计算
					$("#conList").on("click", "#computedData", function () {
						Ewin.confirm({ message: "确定进行一键计算吗？" }).on(function (e) {
							if (!e) return;
							// 一键赋值所有空值为 /
							$.each($('button.formulaBtnOne,button.formulaBtn'), function (i, v) {
								$(v).trigger("click",[false]);
							})
						})
					})
          $("#conList").on("click", "button.Calculate", function () {
            var _that = this;
            var thisCode = $(this).siblings("input")[0].classList.value;
						var name = $(this).siblings("input").attr("dataName");
            var formulaArr = [];
            var inputArr = $(".formulaOne input");
            inputArr.each((index, item1) => {
              var formulaJson = {};
              formulaJson["code"] = item1.classList.value;
              formulaJson["value"] = item1.value * 1;
              formulaArr.push(formulaJson);
            });
            var result = {
              Token: that.token,
              attributeConfigCode: thisCode,
              attributes: formulaArr,
              batchID: that.batchID,
            };
            GetCalculateResult(result)
              .then(function (res) {
                if (res.ErrorCode == 0) {
                  var result = res.Result;
                  $(_that).siblings("input").val(result);
                } else {
                  Notify({ type: "danger", message: `${name}:${res.ErrorMsg}`});
                }
              })
              .catch((res) => {
								Notify({ type: "danger", message: `${name}:${res.ErrorMsg}`});
							});
          });
          $("#conList").on("click", "button.BoolResult", function () {
            var _that = this;
						
            var thisCode = $(this).siblings("input")[0].classList.value;
						var name = $(this).siblings("input").attr("dataName");
						console.log('name',name)
            var formulaArr = [];
            var inputArr = $(".formulaTwo input");
            inputArr.each((index, item1) => {
              var formulaJson = {};
              formulaJson["code"] = item1.classList.value;
              formulaJson["value"] = item1.value * 1;
              formulaArr.push(formulaJson);
            });
            var result = {
              Token: that.token,
              attributeConfigCode: thisCode,
              attributes: formulaArr,
            };
            GetLogicResultAndOr(result)
              .then(function (res) {
                if (res.ErrorCode == 0) {
                  var result = res.Result;
                  $(_that).siblings("input").val(result);
                } else {
                  Notify({ type: "danger", message: `${name}:${res.ErrorMsg}`});
                }
              })
              .catch((res) => {
								Notify({ type: "danger", message: `${name}:${res.ErrorMsg}`});
							});
          });
          $("#conList").on("click", "button.Scan", function () {
            var _that = this;
            that.scanCode = $(this).siblings("input")[0].classList.value;
            that.dataVal = JSON.parse($(this).attr("data-val"));
            that.showEquipType = that.dataVal;
            that.scanShow = true;
            that.scanType = 2;
            if (that.timer1) clearTimeout(that.timer1);
            that.timer1 = setTimeout(that.startRecognize, 1000);
          });
    			// 点击日期一键赋值按钮
          $("#conList").on("click", "button.dateSetBtn", function () {
            var _that = this;
            var dataFormat = $(_that)[0].getAttribute("data-val");
            var inputVal = $(_that).parent().find("input").val();
            var isUpdateDate = $(_that)
              .parent()
              .find("input")
              .attr("data-isUpdateDate");
            let newTime = "";
            if (dataFormat == "yyyy.MM.dd-yyyy.MM.dd") {
              return false;
            } else if (dataFormat == "MM.dd HH:mm") {
              newTime = dayjs(new Date()).format("MM.DD HH:mm");
            } else if (dataFormat == "MM月dd日 HH时mm分") {
              newTime = dayjs(new Date()).format("MM月DD日 HH时mm分");
            } else {
              newTime = that.getTimeFormat(dataFormat);
            }
            if (inputVal && isUpdateDate != "true") {
              Notify({
                type: "danger",
                message: "当前输入框已赋值，不可再进行修改",
              });
              return false;
            }
            Dialog.confirm({
              title: "提示",
              message: `您将填入${$(_that).attr("dataName")}的值为 ${newTime}`,
            })
              .then(() => {
                $(_that).parent().find("input").val(newTime);
              })
              .catch(() => {
                // on cancel
              });
          });
    			// 点击日期清空按钮
    			$("#conList").on("click", "button.dateClearBtn", function () {
    				var _that = this;
            Dialog.confirm({
              title: "提示",
              message: `您将清空${$(_that).attr("dataName")}的值吗？`,
            })
              .then(() => {
                $(_that).parent().find("input").val('');
              })
              .catch(() => {
                // on cancel
              });
          });
    			// 点击日期赋值为 /
    			$("#conList").on("click", "button.dateSetBtnXG", function () {
    				var _that = this;
            var inputVal = $(_that).parent().find("input").val();
            var isUpdateDate = $(_that)
              .parent()
              .find("input")
              .attr("data-isUpdateDate");
            if (inputVal && isUpdateDate != "true") {
              Notify({
                type: "danger",
                message: "当前输入框已赋值，不可再进行修改",
              });
              return false;
            }
            Dialog.confirm({
              title: "提示",
              message: `您将填入${$(_that).attr("dataName")}的值为 /`,
            })
              .then(() => {
                $(_that).parent().find("input").val('/');
              })
          });
    			// 点击日期的输入框，根据类型弹出日期选择器
          $("#conList").on("click", "input[name=Date]", function () {
            var _that = this;

            var dataFormat = $(_that).attr("data-val");
            var dataCode = $(_that).attr("datacode");
            var dataNum = $(_that).attr("datanum");
            var inputLength = $(_that).parent().find("input").length;
            // console.log("inputLength", inputLength);
            // if (inputLength == 1) return false;
            that.minDate = undefined;
            that.maxDate = undefined;
            that.clickCode = dataCode;
            that.currentDate = new Date();
            that.dataNum = dataNum;
            that.dateFormatType = dataFormat;
            if (
              dataFormat == "yyyy.MM.dd" ||
              dataFormat == "yyyy-MM-dd" ||
              dataFormat == "yyyy/MM/dd" ||
              dataFormat == "yyyy年MM月dd日"
            ) {
              that.datePickerType = "date";
            } else if (
              dataFormat == "MM.dd HH:mm" ||
              dataFormat == "MM月dd日 HH时mm分"
            ) {
              that.datePickerType = "datetime";
              that.minDate = new Date(new Date().getFullYear(), 0, 1);
              that.maxDate = new Date(new Date().getFullYear(), 11, 31);
            } else if (
              dataFormat === "yyyy.MM.dd HH:mm" ||
              dataFormat == "yyyy-MM-dd HH:mm" ||
              dataFormat == "yyyy/MM/dd HH:mm" ||
              dataFormat == "yyyy年MM月dd日 HH时mm分"
            ) {
              that.datePickerType = "datetime";
            } else {
              that.datePickerType = "date";
            }
            that.showDate = true;
          });
        },
        getTimeFormat(dataFormat, type) {
          var newTime = "";
          var nowTime = new Date();
          if (type == "addOne") {
            nowTime = new Date(nowTime.getTime() + 24 * 60 * 60 * 1000);
          }
          nowTime.setTime(nowTime.getTime());
          var year = nowTime.getFullYear();
          var month =
            nowTime.getMonth() + 1 < 10
              ? "0" + (nowTime.getMonth() + 1)
              : nowTime.getMonth() + 1;
          var date =
            nowTime.getDate() < 10 ? "0" + nowTime.getDate() : nowTime.getDate();
          var hours =
            nowTime.getHours() < 10 ? "0" + nowTime.getHours() : nowTime.getHours();
          var minutes =
            nowTime.getMinutes() < 10
              ? "0" + nowTime.getMinutes()
              : nowTime.getMinutes();
          if (dataFormat == "yyyy.MM.dd") {
            newTime = year + "." + month + "." + date;
          } else if (dataFormat == "yyyy-MM-dd") {
            newTime = year + "-" + month + "-" + date;
          } else if (dataFormat == "yyyy/MM/dd") {
            newTime = year + "/" + month + "/" + date;
          } else if (dataFormat == "yyyy.MM.dd HH:mm") {
            newTime = year + "." + month + "." + date + " " + hours + ":" + minutes;
          } else if (dataFormat == "yyyy-MM-dd HH:mm") {
            newTime = year + "-" + month + "-" + date + " " + hours + ":" + minutes;
          } else if (dataFormat == "yyyy/MM/dd HH:mm") {
            newTime = year + "/" + month + "/" + date + " " + hours + ":" + minutes;
          } else if (dataFormat == "yyyy年MM月dd日 HH时mm分") {
            newTime =
              year +
              "年" +
              month +
              "月" +
              date +
              "日 " +
              hours +
              "时" +
              minutes +
              "分";
          } else if (dataFormat == "HH:mm") {
            newTime = hours + ":" + minutes;
          } else if (dataFormat == "MM:dd HH:mm") {
            newTime = month + ":" + date + " " + hours + ":" + minutes;
          } else if (dataFormat == "MM月dd日 HH时mm分") {
            newTime = month + "月" + date + "日 " + hours + "时" + minutes + "分";
          }
          return newTime;
        },
        getRecordReportData() {
          var result = {
            pageModel: {
              Token: this.token,
              search: [this.treeNode.code, this.recordCode],
            },
          };
					this.$toast.loading({
						duration: 0
					})
          GetRecordReportData(result)
            .then((response) => {
              if (response.ErrorCode == 0) {
                var res = response.Result.rows;
                this.reason = response.Result.reason || "";
                this.state = response.Result.state;
                $.each(res, function (i, v) {
                  $.each($(".listValue input"), function (ii, vv) {
                    var that = this;
                    if (v.attributeCode == $(that).attr("dataCode")) {
                      if (v.type == "Choose") {
                        $(that).val(v.attributeValue);
                      } else if (v.type == "Select") {
                        if ($(that).attr("type") == "user") {
                          $(that).val(v.userName);
                        } else {
                          $(that).val(v.attributeValue);
                          // $(that).attr("dataUser", v.attributeValue);
                        }
                      } else if (v.type == "PDF") {
                        $(that).val(v.attributeValue);
                        // $(that).attr("dataLine", v.line);
                      } else if (v.type == "Radio") {
                        $(that).val(v.attributeValue);
                      } else if (v.type == "Date") {
                        // console.log($(that).attr('dataNum'))
                        if (!$(that).attr("dataNum")) {
                          $(that).val(v.attributeValue);
                        } else {
                          let dateArr = v.attributeValue.split("-");
                          if ($(that).attr("dataNum") == "1") {
                            $(that).val(dateArr[0]);
                          } else if ($(that).attr("dataNum") == "2") {
                            $(that).val(dateArr[1]);
                          }
                        }
                      } else {
                        $(that).val(v.attributeValue);
                      }
                      $(that).attr("dataIautoid", v.iautoid);
                    }
                  });
                });
								const checkList = ['待保存', '待递交', '已撤回', '驳回']
								if(!checkList.includes(this.state)){
									// 禁用所有输入框
									$.each($(".listDetail input,.listDetail button"), function (i, v) { 
										$(this).attr("disabled", true);
									});
								}


              }
            }).finally(() => {
          	this.$toast.clear()
          })
        },
        showItemPopup() {
          this.showItem = true;
        },
        onConfirm() {
          this.showItem = false;
        },
        cancel() {
          this.showItem = false;
          this.checkBoxArr = [];
          this.checkedAll = false;
        },
        getTestId() {
          var params = {
            pageModel: {
              Search: [this.quote_materialCode, this.quote_batchID],
              Token: this.token,
            },
          };
          getReportId(params)
            .then((response) => {
              if (response.ErrorCode == "0") {
                var res = response.Result;
                var dataArr = [];
                res.map((item) => {
                  dataArr.push({
                    value: item.testID,
                    text: item.testID,
                  });
                });
                this.testList = dataArr;
              }
            })
            .catch(() => {});
        },
        onConfirmTest(val) {
          this.quote_testID = val.value;
          this.showTest = false;
        },
        closePopup() {
          var checkStr = "",
            num = "";
          if (this.checkBoxArr.length > 0) {
            num = this.checkBoxArr.length;
            checkStr = this.checkBoxArr.toString();
          }
          $("[dataCode=" + this.dataCode + "]").attr("dataL", checkStr);
          $("[dataCode=" + this.dataCode + "]").val("已选中" + num + "项");
          // var htlArr = $("#conList").find(".multSelect");
          // if (htlArr.length > 0) {
          //   $.each(htlArr, function (i, v) {
          //     var code = v.attributes[2].value;
          //     $("[dataCode=" + that.dataCode + "]").attr("dataL", checkStr);
          //     $("[dataCode=" + that.dataCode + "]").val("已选中" + num + "项");
          //   });
          // }
        },
        toggleAll() {
          this.$refs.checkboxGroup.toggleAll(this.checkedAll);
        },
        onConfirmSingle(value) {
          if (value.value) {
            $("[dataCode=" + this.dataCode + "]").attr("dataId", value.value);
            $("[dataCode=" + this.dataCode + "]").val(value.text);
          } else {
            $("." + this.dataCode).val(value);
          }

          this.showSingle = false;
        },
        getAddTestData() {
          if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          var result = {
            pageModel: {
              Token: this.token,
              search: [this.mCode, this.recordCode],
            },
          };
          GetRecordReportDataTwo(result)
            .then((response) => {
              if (response.ErrorCode == 0) {
                var res = response.Result;
                $.each(res, function (i, v) {
                  $.each($(".listValue input"), function (ii, vv) {
                    var that = this;
                    if (v.attributeCode == $(that).attr("dataCode")) {
                      if (v.type == "Choose") {
                        $(that).val(v.attributeValue);
                      } else if (v.type == "Select") {
                        if ($(that).attr("type") == "user") {
                          $(that).val(v.userName);
                        } else {
                          $(that).val(v.attributeValue);
                          // $(that).attr("dataUser", v.attributeValue);
                        }
                      } else if (v.type == "PDF") {
                        $(that).val(v.attributeValue);
                        // $(that).attr("dataLine", v.line);
                      } else if (v.type == "Radio") {
                        $(that).val(v.attributeValue);
                      } else {
                        $(that).val(v.attributeValue);
                      }
                      $(that).attr("dataIautoid", v.iautoid);
                      $(that).attr("dataStandardCode", v.standardCode);
                    }
                    // if (v.attributeCode == $(that).attr("data-code")) {
                    //   if (v.type == "Choose") {
                    //     var vArr = v != "" ? v.attributeValue.split(",") : [];
                    //     $(that).multiselect("select", vArr).multiselect("refresh");
                    //   } else if (v.type == "Radio") {
                    //     $(that).val(v.attributeValue).change();
                    //   } else if (v.type == "Select") {
                    //     if ($(that).attr("type") == undefined) {
                    //       $(that).val(v.attributeValue).change();
                    //     } else {
                    //       $(that).val(v.userName);
                    //       $(that).attr("data-user", v.attributeValue);
                    //     }
                    //   } else if (v.type == "PDF") {
                    //     $(that).val(v.attributeValue);
                    //     $(that).attr("data-line", v.line);
                    //   } else {
                    //     $(that).val(v.attributeValue);
                    //   }
                    //   // $(that).attr('data-id', v.iautoid)
                    //   $(that).attr("data-standardCode", v.standardCode);
                    // }
                  });
                });
              }
            })
            .catch(() => {});
        },
        getPDF() {
          if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          var $PDF = $("input[name=PDF]");
          if ($PDF.length == 0) {
            Notify({ type: "danger", message: "无可递交检验项目" });
            return false;
          }
          this.PDFShow = true;
          this.getPDFList();
        },
    		//称重
    		getWeightData(val, code) {
					if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          let type;
          if (val == 1) {
            if (!this.recordCode) {
              type = 1;
            } else {
              type = 2;
            }
          } else {
            type = 3;
          }
					let params = {
              type: type,
              recordCode: this.recordCode,
              attributeCode: code,
              param: {
								batchID: this.batchID,
								materialCode: this.materialCode
							}
            }
    			console.log(this.$route.params.paramData)
						Dialog.confirm({
              title: "提示",
              message: "称重前将进行数据保存，是否继续？",
            })
             .then(() => {
								this.saveItemData(params)
             })
        },
        editData() {
    			if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
					Dialog.confirm({
						title: "提示",
						message: "您将一键赋值所有空值为 / 吗？",
					})
					.then(() => {
						var pNodes = document.getElementById("conList");
						var inputNodes = $(pNodes).find("input");
						inputNodes.map((index, item) => {

							if (item.value == "" && item.name != "Date") {
								item.value = "/";
							}
						});
					})
        },
				computedData() {
    			if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
					Dialog.confirm({
						title: "提示",
						message: "确定进行一键计算吗？",
					})
					.then(() => {
						$.each($('.listDetail button.Calculate,.listDetail button.BoolResult'), function (i, v) {
							$(v).trigger("click");
						})
					})
        },
        saveItemData(model) {
    			if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          var that = this;
          var submitData = [];
          let canSubmit = true;
          var pNodes = document.getElementById("conList");
          var inputNodes = $(pNodes).find("input");
          if (inputNodes.length == 0) {
            return false;
          }
          let num1Date = "";
          let num2Date = "";
          inputNodes.map((index, a) => {
            var subDataObj = {};
            var name = a.getAttribute("name");
            let dataNum = a.getAttribute("datanum");
            if (name == "Select") {
              subDataObj["attributeCode"] = a.getAttribute("datacode");
              subDataObj["attributeValue"] = a.value;
              subDataObj["iautoid"] = a.getAttribute("dataiautoid");
            } else if (name == "Choose") {
              subDataObj["attributeCode"] = a.getAttribute("datacode");
              subDataObj["attributeValue"] = a.getAttribute("datal");
              subDataObj["iautoid"] = a.getAttribute("dataiautoid");
            } else if (name == "Radio") {
              subDataObj["attributeCode"] = a.getAttribute("datacode");
              subDataObj["attributeValue"] = a.value;
              subDataObj["iautoid"] = a.getAttribute("dataiautoid");
            } else if (name == "Date") {
              subDataObj["attributeCode"] = a.getAttribute("datacode");
              subDataObj["iautoid"] = a.getAttribute("dataiautoid");
              if (dataNum == "2") {
    						num1Date = $(a).prev().val();
                num2Date = a.value;
    						console.log('num2Date',num2Date)
                subDataObj["attributeValue"] = num1Date + "-" + num2Date;
              } else {
                subDataObj["attributeValue"] = a.value;
              }
            } else {
              subDataObj["attributeCode"] = a.classList.value;
              subDataObj["attributeValue"] = a.value;
              subDataObj["iautoid"] = a.getAttribute("dataiautoid");
            }
            if (dataNum !== "1") submitData.push(subDataObj);
          });
          if ((num1Date && !num2Date) || (!num1Date && num2Date)) {
            canSubmit = false;
            return Notify({
              type: "warning",
              message: "请填写合适的日期区间再保存!",
            });
          }

          var result = {
            Token: this.token,
            testID: this.mCode,
            batchID: this.batchID,
            recordCode: this.recordCode,
            recordReportData: submitData,
          };
          SaveRecordReportData(result)
            .then( (res)=> {
              if (res.ErrorCode == 0) {
                that.handleItem();
                Notify({ type: "success", message: res.ErrorMsg });
								if(model){
									console.log('model',model)
									this.$router.push({
										name: 'weight',
										params: model
									});
								}
							} else {
                Notify({ type: "danger", message: res.ErrorMsg });
              }
            })
            .catch((err) => {
							if(err.ErrorMsg=='无信息保存！'){
									if(model){
										this.$router.push({
											name: 'weight',
											params: model
										});
									}
								}
						});
        },
        submitItemData() {
    			if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
          var that = this;
          var pNodes = document.getElementById("conList");
          var inputNodes = $(pNodes).find("input");
          var isWrite = false;
          inputNodes.map((index, a) => {
            if (
              a.getAttribute("dataiautoid") == "" ||
              a.getAttribute("dataiautoid") == null
            ) {
              isWrite = true;
            }
          });
          if (isWrite) {
            Notify({ type: "warning", message: "请全部填写保存后,在递交" });
            return false;
          }
          var result = {
            Token: this.token,
            testID: this.mCode,
            recordCode: this.recordCode,
          };
          SubmitRecordApprove(result)
            .then((response) => {
              if (response.ErrorCode == 0) {
                that.itemHtm = "";
                $("#recordPdf").html("");
    						this.recordPdfUrl = "";
    						this.recordName = "";
    						this.recordCode = "";
    						this.state = "";
    						this.fetchItems();
                Notify({ type: "success", message: response.ErrorMsg });
              } else {
                Notify({ type: "danger", message: response.ErrorMsg });
              }
            })
            .catch(() => {});
        },
        openScan(val) {
          this.scanShow = true;
          this.scanType = val;
          this.timer = setTimeout(this.startRecognize, 500);
        },
        startRecognize() {
          var that = this;
          that.timer = null;
          that.timer1 = null;
          if (!window.plus) return;
          scan = new plus.barcode.Barcode("bcid");
          scan.onmarked = onmarked;
          scan.start();
          function onmarked(type, result, file) {
            switch (type) {
              case plus.barcode.QR:
                type = "QR";
                break;
              case plus.barcode.EAN13:
                type = "EAN13";
                break;
              case plus.barcode.EAN8:
                type = "EAN8";
                break;
              default:
                type = "其它" + type;
                break;
            }
            result = result.replace(/\n/g, "");
            scan.close();
            that.scanShow = false;

            if (that.scanType == 2) {
              var str = decodeURIComponent(result);
              var strObj = JSON.parse(str);
              var oldVal = $("." + that.scanCode).val();
              var newVal,
                newArr = [];
              if (
                that.showEquipType &&
                Array.isArray(that.showEquipType) &&
                that.showEquipType.length
              ) {
                that.showEquipType.map((item) => {
                  newArr.push(strObj[item]);
                });
              }
              if (
                that.showEquipType &&
                Array.isArray(that.showEquipType) &&
                that.showEquipType.length
              ) {
                newVal = newArr.toString();
              }
              if (oldVal) {
                if (oldVal.includes(newVal)) {
                  $("." + that.scanCode).val(oldVal);
                  // Notify({ type: "warning", message: "该仪器已存在！" });
                } else {
                  $("." + that.scanCode).val(oldVal + "," + newVal);
                }
              } else {
                $("." + that.scanCode).val(newVal);
              }
            } else if (that.scanType == 1) {
              that.getScanType(JSON.parse(result).testID);
            } else if (that.scanType == 3) {
              console.log(1, JSON.parse(result));
            }
          }
        },
        closeModel() {
          this.scanShow = false;
          if (!window.plus) return;
          scan.close();
        },
        async getScanType(id) {
          var params = {
            queryModel: {
              Code: id,
              Token: this.token,
            },
          };
          const [err, res] = await to(getTestByTestId(params));
          var toDetail = res.Result;
          this.sampleName = toDetail.batchID + "[" + toDetail.standardBaseOn + "]";
          this.mCode = toDetail.testID;
          this.materialName = toDetail.materialName;
          this.batchID = toDetail.batchID;
          this.standardBaseOn = toDetail.standardBaseOn;
          this.materialCode = toDetail.materialCode;
          this.testStandard = toDetail.testStandard;
          this.fetchItems();
          this.itemHtm = "";
          this.recordName = "";
          this.recordCode = "";
          $("#recordPdf").html("");
        },
        showModel(type) {
          if (type == "recordIcon") {
            if (this.itemShow == true) {
              this.itemShow = false;
            } else {
              this.itemShow = true;
            }
          } else if (type == "itemIcon") {
            if (this.recordShow == true) {
              this.recordShow = false;
            } else {
              this.recordShow = true;
            }
          }
        },
        async afterRead(data) {
          let param = new FormData(); //创建form对象
          param.append("txt_fileDocument", data.file);
          param.append("Token", this.token);
          param.append("type", "RecordEquipmentPDF");
          param.append("batchID", this.batchID);
          param.append("materialCode", this.materialCode);
          const [err, res] = await to(uploadEquipmentFile(param));
          this.attachmentId = res.Result.attachmentId;
          this.getPDFList();
        },
        async getPDFList() {
          var params = {
            Token: this.token,
            type: "RecordEquipmentPDF",
            batchID: this.batchID,
            materialCode: this.materialCode,
            recordCode: this.recordCode,
            referBatchID: "/",
          };
          // const [err, res] = await to(getEquipmentFileSelect(params));
          getEquipmentFileSelect(params)
            .then(function (res) {
              var result = res.Result;
              result.map((item) => {
                item.value = item.attachmentId;
                item.text = item.fileName;
              });
              this.pdfArr = result;
            })
            .catch(() => {});
        },
        async delPdfList() {
          var _that = this;
          var params = {
            Token: _that.token,
            attachmentID: _that.attachmentId,
          };
          const [err, res] = await to(deleteEquipFile(params));
          if (this.pdfArr.length > 0) {
            this.pdfArr.map((item, index) => {
              if (item.value == _that.attachmentId) {
                _that.pdfArr.splice(index, 1);
                _that.attachmentId = "";
              }
            });
          }
        },
        showUploadPdf() {
          var _that = this;
          if (this.pdfArr.length > 0) {
            this.pdfArr.map((item, index) => {
              if (item.value == _that.attachmentId) {
                var fileUrl = item.fileUrl;
                var newPdf = _that.gDomain + fileUrl;
                _that.pdfh5 = true;
                _that.$nextTick(() => {
                  _that.pdfh5 = new Pdfh5("#uploadPdf", {
                    newPdf,
                    lazy: true,
                  });
                });
              }
            });
          }
          var htm = "";
          this.itemDataArr.map((item) => {
            if (item.type == "PDF") {
              htm +=
                "<div class='listDetail insideList'><div class='pdfTitle'><input type='checkbox' checked>" +
                item.wordCode +
                ":" +
                item.name +
                "</div>";
              htm +=
                "<div class='listValue popupPdf'>值：<input  name='PDF' class=" +
                item.code +
                " type='text' ></div>";
              htm += "</div>";
            }
            this.pdfHtm = htm;
          });
        },
        async getPdfData() {
          if (this.attachmentId == "") {
            Notify({ type: "danger", message: "请选择PDF文件" });
            return false;
          }
          if ($("#conList [name=PDF]").length == 0) {
            Notify({ type: "danger", message: "无可取值的pdf项目" });
            return false;
          }
          var pdfArr = [];
          var selectArr = [];
          var pdfSelect = $(".pdfTitle");
          var ischecked = false;
          $.each(pdfSelect, function (i, v) {
            if (v.childNodes[0].checked) {
              ischecked = true;
              var pdfJson = {
                attributeValue: "",
              };
              pdfJson["attributeCode"] =
                v.nextSibling.childNodes[1].classList.value;
              pdfArr.push(pdfJson);
              selectArr.push(v.nextSibling.childNodes[1]);
            }
          });
          if (!ischecked) {
            Notify({ type: "danger", message: "请勾选PDF项目" });
            return false;
          }
          var params = {
            Token: this.token,
            attachmentID: this.attachmentId,
            pdfAttributes: pdfArr,
          };
          const [err, res] = await to(getConfigAttributesText(params));
          var result = res.Result.data;
          $.each(selectArr, function (i, v) {
            var that = this;
            $.each(result, function (i1, v1) {
              if (v1.attributeCode == that.classList[0]) {
                $(that).val(v1.attributeValue);
              }
            });
          });
        },
        assignPdfData() {
          $.each($(".pdfTitle"), function (i, v) {
            var that = this;
            var thatCheck = $(this).find("input:eq(0)").prop("checked");
            if (thatCheck) {
              $.each($(".mainPdf"), function (i1, v1) {
                if (
                  $(this)[0].childNodes[1].classList.value ==
                  $(that)[0].nextSibling.childNodes[1].classList.value
                ) {
                  $(this)[0].childNodes[1].value =
                    $(that)[0].nextSibling.childNodes[1].value;
                }
              });
            }
          });
          this.PDFShow = false;
          Notify({ type: "success", message: "赋值成功" });
        },
  			otherCite(){
  				this.citeCheckProjectList = [];

  				if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
					this.$toast.loading({
						duration: 0
					})
  				GetCiteOtherAttributeValue({
  					Token: this.token,
  					TestID: this.treeNode.code,
  					RecordName: this.recordName.split('-')[0]||'',
  					batchID: this.batchID,
  					materialCode: this.materialCode,
  				}).then((res) => {
						this.$toast.clear()
						if(res.ErrorCode == 0){
							if(res.Result && res.Result.length){
								this.citeCheckProjectList = res.Result;
								this.showCite = true;
							}else{
								Notify({ type: "danger", message: '没有查询到可以引用的值' });
							}
						}
						else{
							Notify({ type: "danger", message: res.ErrorMsg });
						}
  				}).catch(err=>{
						Notify({ type: "danger", message: err.ErrorMsg });
						this.$toast.clear()
					})
  			},
  			onConfirmCiteCheckProject({ selectedOptions }){
          this.showCitepCheckProject = false;

  			},
        //引用
        quoteData() {
          // this.$router.push({
          //   name: "recordQuote",
          //   params: {
          //     paramData: JSON.stringify(this.treeNode),
          //     recordName: this.recordName,
          //   },
          // });
          if (this.recordCode == "") {
            Notify({ type: "danger", message: "请选择检验记录" });
            return false;
          }
    			this.quote_materialType = this.treeNode['level0'].code||'';
    			this.quote_materialCode = this.treeNode['level1'].code||'';
    			this.showQuote = true;
        },
        handleSearch() {
          var _this = this;
          var params = {
            TestID: this.quote_testID,
            RecordName: this.recordName,
            Token: this.token,
          };
          GetAttributeValue(params)
            .then((response) => {
              if (response.ErrorCode == "0") {
                var res = response.Result;
                if (res && res.length) {
                  _this.quoteDataArr = res;
                  _this.showBtn = true;
                  var htm = "";
                  res.map((item) => {
                    htm +=
                      "<li>" +
                      item.attributeName +
                      " : " +
                      item.attributeValue +
                      "</li>";
                  });
                  _this.liHtml = htm;
                }
              }
            })
            .catch(() => {});
        },
        handleSave() {
          $.each(this.quoteDataArr, function (i, v) {
            $.each($(".listValue input"), function (ii, vv) {
              var that = this;
              if (v.attributeCode == $(that).attr("dataCode")) {
                if (v.type == "Choose") {
                  $(that).val(v.attributeValue);
                } else if (v.type == "Select") {
                  if ($(that).attr("type") == "user") {
                    $(that).val(v.userName);
                  } else {
                    $(that).val(v.attributeValue);
                    // $(that).attr("dataUser", v.attributeValue);
                  }
                } else if (v.type == "PDF") {
                  $(that).val(v.attributeValue);
                  // $(that).attr("dataLine", v.line);
                } else if (v.type == "Radio") {
                  $(that).val(v.attributeValue);
                } else {
                  $(that).val(v.attributeValue);
                }
                $(that).attr("dataIautoid", v.iautoid);
              }
            });
          });
          this.quote_materialCode = "";
          this.quote_batchID = "";
          this.quote_testID = "";
          this.quoteDataArr = [];
          this.liHtml = "";
          this.showQuote = false;
          this.showBtn = false;
        },
      },
      created() {
        this.treeNode = JSON.parse(this.$route.params.paramData);
    		this.batchList = JSON.parse(this.$route.params.batchList);
        this.mCode = this.treeNode.code;
        this.sampleName = this.treeNode.name;
        this.mCode = this.treeNode.code;
        this.materialName = this.treeNode.materialName;
        this.batchID = this.treeNode.batchID;
        this.standardBaseOn = this.treeNode.standardBaseOn;
        this.materialCode = this.treeNode.materialCode;
        this.testStandard = this.treeNode.testStandard;
      },
    	activated() {
    		this.$nextTick(() => {
          this.fetchItems();
					this.getRecordReportData();
        });
    	}
    };
</script>
<style>
  .van-nav-bar__title {
    color: #fff;
  }
  .van-icon-arrow-left {
    color: #fff !important;
  }
  .van-cell__title {
    text-align: left;
    font-weight: 500;
  }
  .van-button--small {
    height: 0.65rem;
  }
  .cd-content {
    padding: 0.2rem 0.1rem;
    color: #000;
    font-size: 0.36rem;
    height: 100%;
    display: flex;
    flex-wrap: nowrap !important;
  }
  .cd-content > .van-col:first-child {
    margin-right: 10px;
  }
  .cd-content > .van-col {
    height: 100%;
    width: 100%;
    /* overflow-y: auto; */
    border: 1px solid #49bbef;
  }
  .van-dropdown-menu__bar {
    box-shadow: 0 0 0;
    height: 36px;
  }
  #conList {
    width: 100%;
    height: calc(100% - 0.8rem);
    overflow-y: auto;
  }
	.HPDFViewer {
		height: calc(100% - 0.8rem);
	}
  .cd-content > .van-col > .title {
    display: flex;
    justify-content: space-between;
    align-content: center;
    height: 0.8rem;
    line-height: 0.8rem;
    background-color: #49bbef;
    color: #fff;
    padding: 0 0.2rem;
  }
  .recordIcon,
  .itemIcon {
    line-height: 0.8rem;
    display: flex;
    align-items: center;
  }
  #recordPdf,
  #uploadPdf,
  #uploadPdf1 {
    width: 100%;
    height: calc(100% - 0.8rem);
  }
  .listDetail {
    padding: 0.2rem;
    border-bottom: 1px solid #ccc;
  }
  .listDetail input {
    height: 0.6rem;
    width: 100%;
    display: inline-block;
    border: 1px solid #ccc;
    box-sizing: border-box;
  }
  .listDetail input[name="Weight"] {
    background: #ccc;
  }
  .listDetail input[type="checkbox"] {
    width: 12px;
    height: 12px;
  }
  .listDetail span {
    display: inline-block;
    height: 0.6rem;
    width: 20%;
    text-align: center;
    border: 1px solid #ccc;
    border-left: none;
    box-sizing: border-box;
    line-height: 0.6rem;
  }
  .listDetail button {
    height: 0.6rem;
    width: 30%;
    text-align: center;
    border: 1px solid #ccc;
    border-left: none;
    box-sizing: border-box;
    line-height: 0.6rem;
    cursor: pointer;
  }
  .listValue {
    display: flex;
    align-content: center;
  }
  .van-dropdown-menu__title {
    font-size: 0.36rem;
  }
</style>
<style scoped lang="less">
  .configDetail {
    margin: 0;
    padding: 0;
    height: 100%;
    overflow-y: auto;
    // color: #fff;
  }
  .nav-bar {
    background-color: #49bbef;
  }
  .handleContent {
    width: 100%;
  }
  .van-col-style {
    font-size: 0.36rem;
    color: #000;
    text-align: left;
    padding-left: 0.2rem;
    margin-top: 0.2rem;
  }
  .van-col-btn {
    text-align: right;
    margin-right: 0.2rem;
  }
  .van-row-style {
    padding: 0.2rem 0;
    border-bottom: 1px solid #ddd;
  }
  .select-record {
    padding: 0;
  }

  pdf {
    width: 100%;
    height: 500px;
    overflow-y: auto;
  }
  .scan {
    height: 100%;
    width: 100%;
    position: fixed;
    left: 0;
    right: 0;
    top: 0;

    #bcid {
      width: 100%;
      position: absolute;
      left: 0;
      right: 0;
      top: 0;
      bottom: 1rem;
      text-align: center;
      color: #fff;
      background: #ccc;
      font-size: 20px;
      z-index: 999;
      .closeModel {
        position: absolute;
        top: 20px;
        right: 20px;
      }
    }
    footer {
      position: absolute;
      left: 0;
      right: 0;
      bottom: 0;
      bottom: 0;
      height: 1rem;
      font-size: 20px;
      button {
        height: 100%;
        width: 100%;
        border: none;
      }
    }
    /deep/.van-cascader__options {
      height: auto !important;
    }
  }
  /deep/.van-popup {
    overflow-y: hidden;
  }
  .checkbox-con {
    height: calc(100% - 1.2rem);
  }
  .readonly /deep/.van-field__body {
    background: #ddd;
  }
  /deep/.van-cell {
    padding: 0.2rem 0.4rem;
  }
  /deep/.van-field__body {
    border-radius: 2px !important;
    border: 1px solid #ddd;
  }
  /deep/.van-cell {
    font-size: 0.32rem;
  }
  /deep/.van-cascader__header {
    height: 1rem;
  }
  /deep/.van-cascader__tabs.van-tabs--line .van-tabs__wrap {
    height: 1rem;
  }
  .popup-content__title {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 5px 0;
		border-bottom: 1px solid #ccc;
		position: absolute;
    top: 0;
    left: 0;
		width: 100%;
		background-color: #fff;
		height: 30px;
    .title {
      font-size: 16px;
      font-weight: bold;
			text-align: center;
    }
  }
	.citeRecord-box{
		margin-top: 35px;
		padding: 10px;
		height: calc(100% - 70px);
		.citeRecord-box-item{
			display: flex;
    align-items: center;
		border: 1px dashed #ccc;
    margin: 3px 0;
		padding: 0 4px 0px 0px;
		
		.item-title{
			font-size: 12px;
			background-color: #e0e0e0;
    padding: 5px;
		width: 160px;
		text-align: center;
		}
		.item-value{
			font-size: 12px;
			width: 100px;
			padding: 5px;
			width: 160px;
			text-align: center;
		}
	}
}
  .popup-content__footer {
    padding: 10px 15px;
    font-size: 16px;
    box-sizing: border-box;
    ul {
      width: 100%;
      border: 1px solid #ccc;
      min-height: 100px;
      max-height: 300px;
      overflow: auto;
      padding: 10px;
      box-sizing: border-box;
      border-radius: 5px;
    }
  }
</style>
